﻿@using FYSJcrm.Core.Web.Areas.PermManage.Models.AdminUserModels
@model AdminUserEditViewModel

@{
    ViewBag.Title = "编辑管理员";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<style type="text/css">
    body {
        background: #fff !important;
    }
</style>
<div class="wap-container">
    <div class="panel">
        <div class="panel-body">
            <form class="layui-form layui-form-pane">
                <input type="hidden" name="id" value="@Model.AdminUser.Id"/>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="c-red">*</span>所属角色</label>
                            <div class="layui-input-block">
                                <select name="roleId" lay-verify="required">
                                    <option value="">请选择管理员角色</option>
                                    @foreach (var item in Model.Roles)
                                    {
                                        if (item.Id == Model.AdminUser.RoleId)
                                        {
                                            <option value="@item.Id" selected>@item.RoleName</option>
                                        }
                                        else
                                        {
                                            <option value="@item.Id">@item.RoleName</option>
                                        }
                                    }
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="c-red">*</span>登陆帐号</label>
                            <div class="layui-input-block">
                                <input type="text" name="userName" value="@Model.AdminUser.UserName" placeholder="请填写管理员登陆帐号" autocomplete="off" class="layui-input" lay-verify="required" disabled/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="c-red">*</span>登陆密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="password" value="0|0|0|0" placeholder="请填写管理员登陆密码" autocomplete="off" class="layui-input" lay-verify="required" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="c-red">*</span>确认密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="password2" value="0|0|0|0" placeholder="确认密码登陆密码" autocomplete="off" class="layui-input" lay-verify="required" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label"><span class="c-red">*</span>是否启用</label>
                            <div class="layui-input-block">
                                <input type="radio" name="isLock" value="0" title="启用" @(Model.AdminUser.IsLock == 0 ? "checked" : "") />
                                <input type="radio" name="isLock" value="1" title="禁用" @(Model.AdminUser.IsLock == 1 ? "checked" : "")/>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">真实姓名</label>
                            <div class="layui-input-block">
                                <input type="text" name="realName" value="@Model.AdminUser.RealName" placeholder="请填写管理员真实姓名" autocomplete="off" class="layui-input" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机号</label>
                            <div class="layui-input-block">
                                <input type="text" name="telPhone" value="@Model.AdminUser.TelPhone" placeholder="请填写管理员手机号" autocomplete="off" class="layui-input" />
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">邮箱</label>
                            <div class="layui-input-block">
                                <input type="text" name="email" value="@Model.AdminUser.Email" placeholder="请填写管理员邮箱" autocomplete="off" class="layui-input" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12" style="text-align:center;">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="adminForm">提交保存</button>
                        <button type="button" class="layui-btn layui-btn-primary" onclick="layer_close()">取消保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

@section FooterScript{
    <script type="text/javascript">
        layui.use(['form'], function () {
            var form = layui.form;

            //提交表单
            form.on('submit(adminForm)', function (data) {
                savaData('/PermManage/AdminUser/Edit', data.field);
                return false;
            })
        })
    </script>
}

